<template>
  <div class="container">
    <van-nav-bar title="银行入款充值" left-arrow @click-left="onClickLeft">
      <!-- <template #right>
        <van-icon name="search" size="18" />
      </template>-->
    </van-nav-bar>

    <div class="money">
      <span>银行入账</span>
      <span class="inp">{{ money }}<span>元</span></span>
    </div>
    <div class="infos">
      <div class="van-hairline--bottom">
        <span class="before_font">收款银行</span>
        <span>{{ bank_name }}</span>
      </div>
      <div class="van-hairline--bottom">
        <span class="before_font">收款人</span>
        <span>{{ bank_user }}</span>
        <button
          v-clipboard="() => bank_user"
          v-clipboard:success="copy"
          class="copy"
        >
          复制
        </button>
      </div>
      <div>
        <span class="before_font">收款账号</span>
        <span>{{ bank_card }}</span>
        <button
          v-clipboard="() => bank_card"
          v-clipboard:success="copy"
          class="copy"
        >
          复制
        </button>
      </div>
    </div>
    <div class="infos">
      <label class="van-hairline--bottom"
        ><span class="before_font">付款人</span
        ><input
          type="text"
          class="left_line"
          v-model.trim="pay_user"
          placeholder="请输入付款人"
      /></label>
      <label class="van-hairline--bottom"
        ><span class="before_font">附言</span
        ><input
          type="text"
          v-model.trim="pay_remark"
          placeholder="请输入充值附言"
      /></label>
    </div>

    <van-button
      @click="submit"
      class="btn_charge"
      :class="pay_user != '' ? '' : 'no_touch'"
      type="danger"
      >提交</van-button
    >

    <ul class="tip">
      <li>请复制财务账号进行线下汇款充值</li>
      <li>转账成功后填写转账人信息提交耐心等待财务审核即可</li>
      <li>财务收到您的转账后1-5分钟内给您添加额度！</li>
      <li>请您每次转账前务必查最新账号以免给您造成损失！</li>
    </ul>
  </div>
</template>
<script>
import Fetch from "../../utils/fetch";
import Clipboard from "v-clipboard";

export default {
  data() {
    return {
      bank_name: "",
      bank_user: "",
      bank_card: "",
      pay_user: "",
      pay_remark: "",
      money: 0,
    };
  },
  mounted() {
    this.money = this.$route.query.money;
    this.getData();
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    copy() {
      this.$notify({
        background: "#EAF1FF",
        color: "#3292FF",
        message: "复制成功",
      });
    },
    submit() {
      Fetch("/user/invest/applyb", {
        money: this.money,
        remark: this.pay_remark,
        name: this.pay_user,
      }).then(() => {
        this.$notify({
          background: "#EAF1FF",
          color: "#3292FF",
          message: "提交成功",
        });
        this.$router.push("/vip");
      });
    },
    getData() {
      Fetch("/user/invest/bank").then((res) => {
        this.bank_user = res.data.bank_user;
        this.bank_card = res.data.bank_card;
        this.bank_name = res.data.bank_name;
      });
    },
  },
};
</script>
<style lang="less" scoped>
.container {
  min-height: 100%;
  background-color: #f7f8f9;

  .money {
    background-color: #ffffff;
    height: 40px;
    width: 100%;
    font-size: 14px;
    line-height: 40px;
    margin-top: 8px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: flex-start;

    .inp {
      margin-left: 19px;
      > span {
        font-size: 14px;
        display: inline-block;
      }
    }
  }

  .infos {
    background-color: #ffffff;
    font-size: 14px;
    margin-top: 13px;
    > div,
    label {
      display: flex;
      padding: 0 18px;

      height: 40px;
      line-height: 40px;
      border-bottom: 1px solid #e3e4e5;
      justify-content: flex-start;
      align-items: center;
      span.before_font {
        color: #b1b1b1;
        width: 76px;
        font-weight: normal;
      }
      input {
        padding-left: 7px;
        margin-left: 7px;
        height: 30px;
        width: 100%;
      }
    }
    span:last-of-type {
      color: #828282;
      font-weight: bold;
    }
    > div:last-of-type {
      border-bottom: none;
    }

    .copy {
      color: #2d73ff;
      margin-left: auto;
      font-size: 13px;
    }
  }

  > p {
    font-size: 13px;
    line-height: 18px;
    margin: 0 18px;
    color: #b1b1b1;
  }
  .btn_charge {
    width: 318px;
    height: 50px;
    margin: auto;
    display: block;
    background: linear-gradient(180deg, #ff3927, #ff6b4f 133%);
    border-radius: 5px;
    box-shadow: 0px 2px 4px 0px #ffd9d4;
    margin-top: 20px;
  }
  .tip {
    padding: 15px 30px;
    li {
      font-size: 13px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: justify;
      color: #b1b1b1;
      line-height: 20px;
    }
  }
}
</style>
